package seekting.demo2017.activity;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

/**
 * Created by seekting on 17-8-9.
 */

public class HandlerActivity extends Activity {

    private Handler mHandler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mHandler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                Log.d("seekting", "HandlerActivity.handleMessage()" + msg.what);
            }
        };
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {

                Log.d("seekting", "HandlerActivity.run()");
            }
        }, 3000);
        mHandler.sendEmptyMessageDelayed(1, 3000);
        mHandler.removeMessages(0);
    }
}
